package zhuoyue.com.yanjiaohui.acticity;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

import zhuoyue.com.yanjiaohui.R;
import zhuoyue.com.yanjiaohui.adapter.MyPagerAdapter;

public class ProjectManagerActivity extends AppCompatActivity {

    private TabLayout mTabLayout;
    private ViewPager mViewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_project_manager);

        initView();
        List<String> list = new ArrayList<>();
        list.add("全部");
        list.add("待上线");
        list.add("已上线");
        list.add("已下线");

        String[] title = getResources().getStringArray(R.array.title);
        for (int i = 0; i < title.length; i++) {
            TabLayout.Tab tab = mTabLayout.newTab();
            tab.setText(title[i]);
            mTabLayout.addTab(tab);
        }
        mTabLayout.setTabMode(TabLayout.MODE_FIXED);


        MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager(), list);
        mViewPager.setAdapter(adapter);

        mTabLayout.setupWithViewPager(mViewPager);

    }

    private void initView() {


        mTabLayout = (TabLayout) findViewById(R.id.pjm_tab_layout);
        mViewPager = (ViewPager) findViewById(R.id.pjm_viewpager);



    }
}
